package haemers.reflection.tests 
{
	import flash.utils.Dictionary;
	import nl.haemers.data.reflection.IParameter;
	import nl.haemers.data.reflection.Parameters;
	import org.flexunit.Assert;
	/**
	 * ...
	 * @author Jonathan
	 */
	public class ParametersTest 
	{
		private var _basicParams:Parameters;
		
		/** Public methods **/
		[Before]
		public function setup() : void
		{
			_basicParams = new Parameters(_basicXML, ["id", "name"]);
		}
		
		[Test]
		public function testCollection() : void
		{
			Assert.assertNotNull(_basicParams.getParameters());
			Assert.assertTrue(_basicParams.getParameters() is Dictionary);
		}
		
		[Test]
		public function testLookUp() : void
		{
			Assert.assertNotNull(_basicParams.getParameter("id"));
			Assert.assertTrue(_basicParams.getParameter("id") is IParameter);
			Assert.assertTrue(_basicParams.hasParameter("id"));
			
			Assert.assertNotNull(_basicParams.getParameter("name"));
			Assert.assertTrue(_basicParams.getParameter("name") is IParameter);
			Assert.assertTrue(_basicParams.hasParameter("name"));
		}
		
		[After]
		public function teardown() : void
		{
			_basicParams = null;
			
			_basicXML = null;
		}
		/** Getters & Setters **/
		
		/** Protected methods **/
		
		/** Private methods **/
		
		private var _basicXML:XML = new XML(
			<method name="addName" declaredBy="haemers.reflection.data.vo::MethodVO" returnType="void">
				<parameter index="1" type="Number" optional="false"/>
				<parameter index="2" type="String" optional="false"/>
				<metadata name="Serialize">
				  <arg key="params" value="id,name"/>
				</metadata>
				<metadata name="__go_to_definition_help">
				  <arg key="pos" value="482"/>
				</metadata>
			</method>
		);
	}

}